package org.cyb.demo.domain;

import java.util.ArrayList;
import java.util.List;

public class Chapter implements Comparable<Chapter>{
    private int chapterId;
    private int chapterNumber;
    private String chapterName;
    private List<Section> sectionList;

    public Chapter() {
        super();
        sectionList = new ArrayList<Section>();
    }

    public int getChapterId() {
        return chapterId;
    }

    public void setChapterId(int chapterId) {
        this.chapterId = chapterId;
    }

    public int getChapterNumber() {
        return chapterNumber;
    }

    public void setChapterNumber(int chapterNumber) {
        this.chapterNumber = chapterNumber;
    }

    public String getChapterName() {
        return chapterName;
    }

    public void setChapterName(String chapterName) {
        this.chapterName = chapterName;
    }

    public List<Section> getSectionList() {
        return sectionList;
    }

    public void setSectionList(List<Section> sectionList) {
        this.sectionList = sectionList;
    }

    @Override
    public int compareTo(Chapter chapter) {
        if(this.chapterNumber > chapter.getChapterNumber()){
            return 1;
        }else if(this.chapterNumber < chapter.getChapterNumber()){
            return -1;
        }
        return 0;
    }
}
